package com.shanxia.codec.enums;

import java.util.Objects;

public enum BatteryIsolationStatusEnum {

    NORMAL(0x00, "正常"),
    TOO_HIGH(0x01, "不正常"),
    TOO_LOW(0x10, "不可信状态"),
    UNKNOWN(99, "未知");

    public static BatteryIsolationStatusEnum getByCode(int code) {
        for (BatteryIsolationStatusEnum enums : BatteryIsolationStatusEnum.values()) {
            if (Objects.equals(enums.code, code)) {
                return enums;
            }
        }
        return BatteryIsolationStatusEnum.UNKNOWN;
    }

    BatteryIsolationStatusEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int code;
    public String name;
}